package org.mebusw.dbc;

import java.sql.*;

public class DataBaseConnection {
	public static final String DBDRIVER = "com.mysql.jdbc.Driver";
	public static final String DBURL = "jdbc:mysql://localhost/davinci?useUnicode=true&characterEncoding=GBK";
	public static final String DBUSER = "";
	public static final String DBPASSWORD = "";
	private Connection conn = null;

	
	public DataBaseConnection() {
		try	{
			Class.forName(DBDRIVER);
			conn = DriverManager.getConnection(DBURL, DBUSER, DBPASSWORD);
		} catch (Exception e){
			e.printStackTrace();
		}
	}

	public Connection getConnection() {
		return conn;
	}

	public void close() {
		if (this.conn != null)	{
			try{
				this.conn.close();
			} catch (Exception e){}
		}
	}
}
